<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="joda" uri="http://www.joda.org/joda/time/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Setting - Acu Address</title>
<link rel="stylesheet" href="<c:url value="/css/tableStyle.css"/>" />

<style>
	*{
		transition: all 220ms ease;
	}
	#article{
		position: absolute;
		left:50%;
		top:20px;
		margin-left: -622px;
	}
	
	#insertTr{
		display:none;
	}
	
	div[title="table1Col1"]{
		width: 96px;
	}
	div[title="table1Col2"]{
		width: 48px;
	}
	div[title="table1Col3"]{
		width: 96px;
	}
	div[title="table1Col4"]{
		width: 72px;
	}
	div[title="table1Col5"]{
		width: 72px;
	}
	div[title="table1Col6"]{
		width: 216px;
	}
	div[title="table1Col7"]{
		width: 96px;
	}
	div[title="table1Col8"]{
		width: 96px;
	}
	div[title="table1Col9"]{
		width: 156px;
	}
	div[title="table1Col10"]{
		width: 96px;
	}
	div[title="table1Col11"]{
		width: 156px;
	}
</style>

<script>
	window.onload = function(){
		document.getElementById("openInsert").onclick = openInsert;
		document.getElementById("insertReset").onclick = insertReset;
	}
	
	function openInsert(){
		document.getElementById("insertTr").style.display = "table-row";
		//document.getElementById("insertTr").style.height = "auto";

	}
	function insertReset(){
		document.getElementById("insertTr").style.display = "none";
		//document.getElementById("insertTr").style.height = "0px";
		
	}
</script>

</head>
<body>
<div id="article">
<h1>Acu Address List : ${fn:length(models)} row(s) selected</h1>

<s:form namespace="/setting" method="post" action="acuAddr">
<div class="table" style="width:1244px;">
	<div class="tr">
		<div class="td"><input class="button1" type="button" id="openInsert" value="新增"/></div>
		<div class="td" style="text-align: right"><label>AcuNo:</label>
			<input type="text" size="10" name="searchBox" value="${searchBox }"/>
			<s:submit cssClass="button" value="搜尋" method="search" /></div>
	</div>
</div>
</s:form>
<div class="table" style="width:1244px;">
	<form>
	<div class="tr" id="tableHeader">
		<div class="th" title="table1Col1"> FUNCTION</div>
		<div class="th" title="table1Col2"> ID</div>
		<div class="th" title="table1Col3"> AcuNo</div>
		<div class="th" title="table1Col4"> AddrCode</div>
		<div class="th" title="table1Col5"> RodCode</div>
		<div class="th" title="table1Col6"> AddeTxt</div>
		<div class="th" title="table1Col7"> AcuSt</div>
		<div class="th" title="table1Col8"> Creator</div>
		<div class="th" title="table1Col9"> CreateTime</div>
		<div class="th" title="table1Col10"> Modifier</div>
		<div class="th" title="table1Col11"> ModifiedTime</div>
	</div>
	</form>
	<s:form namespace="/setting" method="post" action="acuAddr">
	<div class="tr" id="insertTr">
		<div class="td" title="table1Col1"><s:submit cssClass="button1" value="送出" method="insert" />
			<input class="button1" type="reset" id="insertReset" value="取消" /></div>
		<div class="td" title="table1Col2"><input disabled="disabled" type="text" size="2" name="model.id" value=""/></div>
		<div class="td" title="table1Col3"><input type="text" size="10" name="model.acuNo" value=""/></div>
		<div class="td" title="table1Col4"><input type="text" size="6" name="model.addrCode" value=""/></div>
		<div class="td" title="table1Col5"><input type="text" size="6" name="model.rodCode" value=""/></div>
		<div class="td" title="table1Col6"><input type="text" size="30" name="model.addeTxt" value=""/></div>
		<div class="td" title="table1Col7"><input type="text" size="10" name="model.acuSt" value=""/></div>
		<div class="td" title="table1Col8"><input disabled="disabled" type="text" size="10" name="model.creator" value=""/></div>
		<div class="td" title="table1Col9"><input disabled="disabled" type="text" size="20" name="model.createTime" value=""/></div>
		<div class="td" title="table1Col10"><input disabled="disabled" type="text" size="10" name="model.modifier" value=""/></div>
		<div class="td" title="table1Col11"><input disabled="disabled" type="text" size="20" name="model.modifiedTime" value=""/></div>
	</div>
	</s:form>
<s:iterator value="models" >
	<s:form namespace="/setting" method="post" action="acuAddr">
	<div class="tr">
		<div class="td" title="table1Col1"><s:submit cssClass="button" value="修改" method="update" />
			<s:submit cssClass="button" value="刪除" method="delete" /></div>
		<div class="td" title="table1Col2"><input readonly="readonly" type="text" size="2" name="model.id" value="${id}"/></div>
		<div class="td" title="table1Col3"><input type="text" size="10" name="model.acuNo" value="${acuNo}"/></div>
		<div class="td" title="table1Col4"><input type="text" size="6" name="model.addrCode" value="${addrCode}"/></div>
		<div class="td" title="table1Col5"><input type="text" size="6" name="model.rodCode" value="${rodCode}"/></div>
		<div class="td" title="table1Col6"><input type="text" size="30" name="model.addeTxt" value="${addeTxt}"/></div>
		<div class="td" title="table1Col7"><input type="text" size="10" name="model.acuSt" value="${acuSt}"/></div>
		<div class="td" title="table1Col8"><input readonly="readonly" type="text" size="10" name="model.creator" value="${creator}"/></div>
			<joda:format var="createTimeJoda" value="${createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
		<div class="td" title="table1Col9"><input readonly="readonly" type="text" size="20" name="model.createTime" value="${createTimeJoda}"/></div>
		<div class="td" title="table1Col10"><input readonly="readonly" type="text" size="10" name="model.modifier" value="${modifier}"/></div>
			<joda:format var="createTimeJoda" value="${modifiedTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
		<div class="td" title="table1Col11"><input readonly="readonly" type="text" size="20" name="model.modifiedTime" value="${createTimeJoda}"/></div>
	</div>
	</s:form>
</s:iterator>
</div>
<br/>
<br/>
<c:if test="${not empty errors.QueryFail}">
	<c:forEach var="error" items="${errors.QueryFail}">
		<label class="error">${error}</label><br/>
	</c:forEach>
</c:if>
<c:if test="${not empty errors.InputFail}">
	<c:forEach var="error" items="${errors.InputFail}">
		<label class="error">${error}</label><br/>
	</c:forEach>
</c:if>
</div>
</body>
</html>